package com.itheima.service;

import org.junit.Test;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;
import redis.clients.jedis.Pipeline;

public class TestRedisSerice {

    Jedis jedis = new Jedis("47.111.249.149", 6379);

    @Test
    public void send() {
        jedis.publish("cctv1","似的发射点发射点");
        /*Pipeline pip = jedis.pipelined();
        pip.set("aaa","aaaaaaa");
        pip.set("bbb","bbbbbbbbbbbb");
        pip.set("ccc","ccccccccc");
        pip.set("ddd","ddddddddddddd");
        pip.exec();*/
    }

    @Test
    public void res() {
        jedis.subscribe(new JedisPubSub() {
            @Override
            public void onMessage(String channel, String message) {
                System.out.println(message);
                super.onMessage(channel, message);
            }
        }, "cctv1");
    }
}
